home *** CD-ROM | disk | FTP | other *** search
- head 1.4;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @@;
-
-
- 1.4
- date 91.04.12.19.44.15; author kupfer; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 89.01.09.10.22.23; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.12.30.15.49.47; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.12.30.15.49.25; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.4
- log
- @Add strdup().
- @
- text
- @.\" Copyright (c) 1980 Regents of the University of California.
- .\" All rights reserved. The Berkeley software License Agreement
- .\" specifies the terms and conditions for redistribution.
- .\"
- .\" @@(#)string.3 6.5 (Berkeley) 10/22/87
- .\" $Header$
- .\"
- .TH STRING 3 "April 12, 1991"
- .UC 4
- .SH NAME
- strcat, strncat, strcmp, strncmp, strcasecmp, strncasecmp, strcpy,
- strncpy, strdup, strlen, strchr, index, strrchr, rindex, strstr,
- strspn, strcspn, strpbrk \- string operations
- .SH SYNOPSIS
- .nf
- .B #include <string.h>
- .PP
- .B char *strcat(s, append)
- .B char *s, *append;
- .PP
- .B char *strncat(s, append, count)
- .B char *s, *append;
- .B int count;
- .PP
- .B strcmp(s1, s2)
- .B char *s1, *s2;
- .PP
- .B strncmp(s1, s2, count)
- .B char *s1, *s2;
- .B int count;
- .PP
- .B strcasecmp(s1, s2)
- .B char *s1, *s2;
- .PP
- .B strncasecmp(s1, s2, count)
- .B char *s1, *s2;
- .B int count;
- .PP
- .B char *strcpy(to, from)
- .B char *to, *from;
- .PP
- .B char *strncpy(to, from, count)
- .B char *to, *from;
- .B int count;
- .PP
- .B char *strdup(s)
- .B char *s;
- .PP
- .B strlen(s)
- .B char *s;
- .PP
- .B char *strchr(s, c)
- .B char *s;
- .B int c;
- .PP
- .B char *index(s, c)
- .B char *s, c;
- .PP
- .B char *strrchr(s, c)
- .B char *s;
- .B int c;
- .PP
- .B char *rindex(s, c)
- .B char *s, c;
- .PP
- .B char *strstr(s, s2)
- .B char *s, *s2;
- .PP
- .B int strspn(s, s2)
- .B char *s, *s2;
- .PP
- .B int strcspn(s, s2)
- .B char *s, *s2;
- .PP
- .B char *strpbrk(s, s2)
- .B char *s, *s2;
- .fi
- .SH DESCRIPTION
- These functions operate on null-terminated strings.
- They do not check for overflow of any receiving string.
- .PP
- \fIStrcat\fP appends a copy of string \fIappend\fP to the end of string
- \fIs\fP. \fIStrncat\fP copies at most \fIcount\fP characters. Both
- return a pointer to the null-terminated result.
- .PP
- \fIStrcmp\fP compares its arguments and returns an integer greater than,
- equal to, or less than 0, according as \fIs1\fP is lexicographically
- greater than, equal to, or less than \fIs2\fP. \fIStrncmp\fP makes the
- same comparison but looks at at most \fIcount\fP characters.
- \fIStrcasecmp\fP and \fIstrncasecmp\fP are identical in function, but are
- case insensitive. The returned lexicographic difference reflects a
- conversion to lower-case.
- .PP
- \fIStrcpy\fP copies string \fIfrom\fP to \fIto\fP, stopping after the
- null character has been moved. \fIStrncpy\fP copies exactly \fIcount\fP
- characters, appending nulls if \fIfrom\fP is less than \fIcount\fP
- characters in length; the target may not be null-terminated if the
- length of \fIfrom\fP is \fIcount\fP or more. Both return \fIto\fP.
- .PP
- \fIStrdup\fP allocates storage for a copy of \fIs\fP, copies
- \fIs\fP into it, and returns the copied string. The copy may be freed
- by calling
- .IR free (3).
- .PP
- \fIStrlen\fP returns the number of non-null characters in \fIs\fP.
- .PP
- \fIStrchr\fR and \fIindex\fR both return pointers to the first occurrence
- of character \fIc\fR in string \fIs\fR or \fBNULL\fR if \fIc\fR does not
- occur in the string. The two procedures are identical except for their
- names and the argument \fIc\fR, which is an \fBint\fR in \fIstrchr\fR and
- a \fBchar\fR in \fIindex\fR. With the ANSI C standard, \fIindex\fR is
- becoming obsolete.
- .PP
- \fIStrrchr\fR and \fIrindex\fR are identical to \fIstrchr\fR and
- \fIindex\fR except that the return the address of the last occurrence
- of \fIc\fR instead of the first. \fIRindex\fR is also becoming
- obsolete.
- .PP
- \fIStrstr\fR locates the first occurrence in the string pointed to by
- \fIs\fR of the sequence of characters (not including the terminating
- null character) in the string pointed to by \fIs2\fR. If a match is
- found, the return value is the address of the first character in the
- matching substring. Otherwise, \fBNULL\fR is returned. If \fIs2\fR points
- to a string with zero length, then \fIs\fR is returned.
- .PP
- \fIStrspn\fR returns the length of the longest initial segment of
- \fIs\fR that consists entirely of characters from the string pointed
- to by \fIs2\fR. \fIStrcspn\fR returns the length of the longest
- initial segment of \fIs\fR that consists entirely of characters not
- in the string pointed to by \fIs2\fR.
- .PP
- \fIStrpbrk\fR returns the address of the first character in the
- string pointed to by \fIs\fR of any character in the string pointed to
- by \fIs2\fR. If no character from \fIs2\fR occurs in \fIs1\fR, then
- \fBNULL\fR is returned.
-
- .SH KEYWORDS
- compare, copy, string
- @
-
-
- 1.3
- log
- @Document additional procedures: strspn, strcspn, strchr, strrchr, strstr,
- strpbrk.
- @
- text
- @d6 1
- d8 1
- a8 1
- .TH STRING 3 "October 22, 1987"
- d12 1
- a12 1
- strncpy, strlen, strchr, index, strrchr, rindex, strstr,
- d46 3
- d99 5
- @
-
-
- 1.2
- log
- @Switch include file name.
- @
- text
- @d11 2
- a12 1
- strncpy, strlen, index, rindex \- string operations
- d48 4
- d55 4
- d61 12
- d98 32
- a129 5
- .I Index
- .RI ( rindex )
- returns a pointer to the first (last) occurrence of character
- \fIc\fP in string \fIs\fP or zero if \fIc\fP does not occur in
- the string. Setting \fIc\fP to NULL works.
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d14 1
- a14 1
- .B #include <strings.h>
- @
-